<template>
    <div >
        <el-button @click="query()">anniu</el-button>
        <el-form>
            <el-form-item >
                <div style="background-color:lightcoral;height:100px">
                    <el-col  :span="1">
                            <p>这是标签</p>
                    </el-col>
                    <el-col :span="21">
                        <p>这是右侧标签</p>
                    </el-col>                    
                </div><br/><br/>
                <div style="background-color:lightcoral;height:50px">
                    <button >编辑</button>
                </div>
            </el-form-item>
        </el-form>
    </div>
</template>

<script>
export default{
    data () {
        return {
            userName:'',
            //从后台获取的问卷信息
            WholeSurvey:{
                userId:'',
                userName:'',
                survey: {
                    surId: '',
                    userId: '3',
                    state:'1',  //1:未发布2：已发布
                    surTitle:'问卷题目',
                    surDate:'6',
                    surNum:'',    //感觉不需要，先放着
                },
                 wholeTitles:[{                  
                    title:{
                        type:'1',
                        must: 1,
                        content:'',
                        titNum:'1',
                    },
                    choices: [                       //选项的信息  
                        {
                        choiceNum: 1,               //choiceNum表示选项号 
                        content: ''                  //表示内容
                        }]    
                 }],     
            }            
        }
    },
    methods: {
        query(){
            console.log(this.userName)
        }
    },
    created () {
        this.userName=sessionStorage.userName;
        console.log(this.userName);
        //创建时就从后台获取所有数据
        this.$axios.post('http://localhost:8082/home/query',this.userName,{
            headers: {
                'Content-Type': 'application/json; charset=UTF-8'
                }
        }).then(res=>{
            this.WholeSurvey=res.data.data.WholeSurvey;
            console.log(this.WholeSurvey);
            //console.log(res.data)
        })
    }
}
</script>
<style>
.left{
    margin-left: 0px;
    background: rgb(150, 95, 95);
    display: inline;
    text-align: left;
    width: 30px;
    left: 20px;
}
.right{
    margin-left: 0px;
    background: rgb(150, 95, 95);
    display: inline;
    text-align: right;
    width: 500px;
}
.test{
    background: lightcoral;
}
</style>